package com.lyr.bank2;

public class Client extends Thread{

    // 想要取的金额
    private int want;
    // 共享资源
    private Bank bank;

    public Client(String name, int want, Bank bank) {
        super(name);
        this.want = want;
        this.bank = bank;
    }

    @Override
    public void run() {
        int money=0;
        // 判断，取款金额大于0时，进行取款操作

        while ((money=this.bank.getMoney(want))>0){

        }
        System.out.println("取款结束！！");

    }
}
